import BaseItemView from "../../../cfw/mvc/BaseItemView";
import Player from "../Player";
import GlobalEvent from "../../../cfw/event/GlobalEvent";
import { EventName } from "../../../public/Config";


const { ccclass, property } = cc._decorator;

@ccclass
export default class PlayerAdgeView extends BaseItemView {

    @property(cc.Node)
    angle: cc.Node = null;

    @property
    adge: number = 1;




    start() {
        this.updateLevel()
        GlobalEvent.instance().on(EventName.CHANGE_LEVEL,this.updateLevel,this)
    }

    onDestroy(){
        GlobalEvent.instance().off(EventName.CHANGE_LEVEL,this.updateLevel,this)
    }

    updateLevel(){
        if(Player.instance().getLevel() != this.adge){
            this.angle.active = false
        }else{
            this.angle.active = true;
        }
    }

    // update (dt) {}
}
